package com.codeant.bikeindicatorapplication.tools;

import android.content.Context;
import android.view.HapticFeedbackConstants;
import android.view.View;

public class ClickFeedbackHelper {

    public void feedback(View v, Context context){

        //让可点击事件带有震动反馈（仅线性马达）
        if(v.isHapticFeedbackEnabled()){
            v.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS, HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
        }else {
//            Vibrator vibrator = (Vibrator) context.getSystemService(Service.VIBRATOR_SERVICE);
//            vibrator.vibrate(100);
//            vibrator.cancel();
        }
    }
}
